'
'   XC Engine (project Minotaur)
'   Copyright (C) 2009 Stanislav Hordiyenko
'
'   This program is free software; you can redistribute it and/or modify
'   it under the terms of the GNU General Public License as published by
'   the Free Software Foundation; either version 3 of the License, or
'   (at your option) any later version.
'
'   This program is distributed in the hope that it will be useful,
'   but WITHOUT ANY WARRANTY; without even the implied warranty of
'   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'   GNU General Public License for more details.
'
'   You should have received a copy of the GNU General Public License
'   along with this program; if not, see http://www.gnu.org/licenses
'   or write to the Free Software Foundation,Inc., 51 Franklin Street,
'   Fifth Floor, Boston, MA 02110-1301 USA
'

'Set objLogger = New Logger

Class Logger
	Private objFso
	Private objLogFile
	
	Private Sub Class_Initialize()
		Const intForAppending = 8

		Set objFso = Nothing
		Set objLogFile = Nothing
		
		Set objFso = CreateObject("Scripting.FileSystemObject")
		
		'If Not objFso.FileExists() Then
		'End If
		
		Set objLogFile = objFso.OpenTextFile(ApplicationPath() & "log\log.txt", intForAppending, True)
	End Sub
	
	Private Sub Class_Terminate()
		If Not(objLogFile Is Nothing) Then objLogFile.Close()
		
		Set objFso = Nothing
	End Sub
	
	Public Sub InfoLog(ByVal strLogMessage)
		objLogFile.WriteLine(Now() & " [Info] " & strLogMessage)
	End Sub
	
	Public Sub WarningLog(ByVal strLogMessage)
		objLogFile.WriteLine(Now() & " [Warning] " & strLogMessage)
	End Sub
	
	Public Sub ErrorLog(ByVal strLogMessage)
		objLogFile.WriteLine(Now() & " [Error] " & strLogMessage)
	End Sub
End Class